package cn.lxh.ymcc.feign;

import cn.lxh.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * component 记住一定要加上  实现FallbackFactory
 */
@Component
public class CourseUserLearnFeignClientFallBackFactory implements FallbackFactory<CourseUserLearnFeignClient> {
    @Override
    public CourseUserLearnFeignClient create(Throwable throwable) {
        return new CourseUserLearnFeignClient() {
            @Override
            public JSONResult checkUrlPermission(Long courseId, Long loginId) {
                throwable.printStackTrace();
                return JSONResult.error("课程服务不可达！！");
            }
        };
    }
}